package cn.duwey.scs.feign.consumer.controller;

import cn.duwey.scs.api.user.UserApi;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignConsumerController {

    @Autowired
    private UserApi userApi;

    @GetMapping(value = "/findUserById/{id}")
    public String consumeFindById(@PathVariable("id") Long id) {
        return JSON.toJSONString(userApi.findById(id));
    }

}
